package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.Schedule;
import cn.wolfcode.crm.mapper.ScheduleMapper;
import cn.wolfcode.crm.page.PageResult;
import cn.wolfcode.crm.query.QueryObject;
import cn.wolfcode.crm.service.IScheduleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ScheduleServiceImpl implements IScheduleService {
    @Autowired
    private ScheduleMapper scheduleMapper;

    public PageResult query(QueryObject qo) {
        int totalCount = scheduleMapper.queryForCount(qo);
        if (totalCount == 0) {
            return new PageResult();
        }
        List<Schedule> list = scheduleMapper.queryForList(qo);
        return new PageResult(totalCount, list);
    }
}
